package ru.alt22.visor.php.unittests.core;

import ru.alt22.visor.php.core.reflection.ReflectionClass;
import ru.alt22.visor.php.core.reflection.ReflectionMethod;

public class PHPTestCase implements PHPTest {
	private ReflectionMethod method;
	private PHPTestCaseResult result = PHPTestCaseResult.notRunned(); 

	public PHPTestCase(ReflectionMethod method) {
		this.method = method;
	}

	public ReflectionClass getReflectionClass() {
		return method.getReflectionClass();
	}

	public String getClassName() {
		return method.getReflectionClass().getName();
	}

	public String getName() {
		return method.getName();
	}

	public String getFullName() {
		return getClassName() + "::" + getName();
	}

	public int countTestCases() {
		return 1;
	}

	public void run(PHPTestResult result, PHPProxy proxy) {
		result.testCaseStarted(this);
		
		this.result = proxy.executeTestCase(this); 

		result.testCaseFinished(this);
	}

	public PHPTestCaseResult getResult() {
		return result;
	}

}